<html>

<head>

<link rel="stylesheet" type="text/css" href="${def:context}/default.css" />

<!--biblioteca generica JS/Dinamica-->
<script type="text/javascript" src="${def:context}/action/script">
</script>

<title>选择户型信息</title>

</head>

<body>

<!--COMMON HEADER-->
${inc:/action/pub/header}

<!--banner-->
<div class="banner" style="height: 15px; margin-bottom: 0px; font-weight: normal">
	<div style="float: left">选择户型信息</div>
	<div style="float: right">
		<img src="${def:context}/images/close.gif" class="button" onclick="parent.pickClose()" title="关闭">
	</div>
</div>


<center>

<!--formulario de filtro-->
<div id="form">
<form name="form1" onsubmit="return search()" style="margin-top: 5px; margin-bottom: 0px;">

<table width="100%" class="formgrid" style="border-left: none; border-right: none">

	<!--ancho de la columna de etiquetas-->
	<col width="35%">

	<!--campos-->
	<tr>
		<td class="formlabel" style="vertical-align: middle">输入查询条件:</td>
		<td>
			<input name="name" type="text" size="15" value="" maxlength="35"> 
			<input type="submit" value="查询" class="button" style="font-size: 9pt"> 
			<span style="${fld:display}">
			<input type="button" value="增加" class="button" style="font-size: 9pt" title="增加新的户型" onclick="addNew()">
			</span>
		</td>
	</tr>

</table>

</form>
</div>

<!--formulario para a馻dir nuevo registro-->
<div id="addnew" style="display: none">
<form name="form2" onsubmit="return insert()" style="margin-top: 20px;">
<table width="80%" class="formgrid">

	<!--ancho de la columna de etiquetas-->
	<col width="30%">

	<!--separador-->
	<tr style="height: 10px">
		<td colspan="2"></td>
	</tr>

	<!--campos-->
	<tr>
		<td>
			<TABLE class="table_comm" cellSpacing=0 cellPadding=0 width="100%" border=0>
				<tr>
					<td class="th20 required">户型名称</td>
					<td class="td20left">
						<input name="room_type" type="text" size="20" maxlength="64" value="">
					</td>
				</tr>
				<tr>
					<td class="th20 required">最小标准面积</td>
					<td class="td20left">
						<input name="min_area" type="text" size="20" maxlength="64" value="">
					</td>
				</tr>
				<tr>

				<tr>
					<td class="th20 required">最大标准面积</td>
					<td class="td20left">
						<input name="max_area" type="text" size="20" maxlength="64" value="">
					</td>
				</tr>
				<tr>
			</TABLE>
		</td>
	</tr>

	<!--separador-->
	<tr style="height: 10px">
		<td colspan="2"></td>
	</tr>

	<tr>
		<td colspan="2" align="center"><input type="submit" value="保存" class="button" style="font-size: 9pt">
			<input 	type="button" value="取消" class="button" style="font-size: 9pt" onclick="cancelAddnew()">
		</td>
	</tr>

	<!--separador-->
	<tr style="height: 10px">
		<td colspan="2"></td>
	</tr>

</table>
</form>
</div>


<!--indicador de progreso-->
<div id="status" class="alert"	style="display: none; color: gray; width: 60%; font-weight: normal; font-family: Arial; margin-top: 10px">
	<img src="${def:context}/images/progress.gif"> 请稍候...
</div>

<!--panel de respuesta AJAX-->
<div id="response" style="display: none; width: 100%; margin-top: 7px">
</div>

</center>

</body>

<!--codigo de soporte del template-->
<script type="text/javascript">

		var currstyle = "";

		//inicializacion de la pagina cuando carga
		onload = function()
		{ 
			document.form1.elements[0].focus();
			changeRequiredStyle();
			
		} 
	
		//mostrar filtro de busqueda
		function showFilter()
		{
			document.form1.elements[0].focus();			
		}

		//ejecutar consulta
		function search()
		{

			//llamada Ajax...
			return ajaxCall(	httpMethod="POST", 
								uri="${def:actionroot}/search", 
								divResponse="response", 
								divProgress="status", 
								formName="form1", 
								afterResponseFn=showFilter, 
								onErrorFn=showFilter);
		
		}
	
		//leer una pagina del grid
		function viewPage()
		{
			var url = "${def:actionroot}/view";
			gotoPage(url);
		}

		//resaltar row del grid
		function rowOn(obj) {
			currStyle = obj.className;
			obj.className="hilite";
		}
		
		//restaurar color normal del row del grid
		function rowOff(obj) {
			obj.className=currStyle
		}
		
		//retornar el item seleccionado a la pagina que llamo al picklist
		function selectItem(id) {
			var description = document.getElementById(id).innerHTML;
			parent.pickSelect(id, description);
			parent.pickClose();
		}
		
		//mostrar formulario para addnew
		function addNew() {
			document.getElementById("addnew").style.display="block";
			document.getElementById("form").style.display="none";
			document.getElementById("response").style.display="none";
			document.form2.room_type.focus();
		}
		
		function cancelAddnew() {
			document.getElementById("addnew").style.display="none";
			document.getElementById("form").style.display="block";
			document.form1.name.focus();
		}
		
		//ejecutar consulta
		function insert()
		{
			//llamada Ajax...
			return ajaxCall(	httpMethod="POST", 
								uri="${def:actionroot}/insert", 
								divResponse=null, 
								divProgress="status", 
								formName="form2", 
								afterResponseFn=null, 
								onErrorFn=addNew);
		}		
		
		search();
</script>

</html>
